{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "ecg-mit.ipynb",
      "provenance": [],
      "collapsed_sections": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "accelerator": "GPU"
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "87hrfLwrHd24",
        "colab_type": "text"
      },
      "source": [
        "Make your google drive account and setup your google drive on your computer. \n",
        "Open a new colab jupyter notebook at https://colab.research.google.com/drive\n",
        "and follow next codes\n",
        "Connect your google drive to the colab server. \n",
        "And make sure you choose GPU at Edit/Notebook Setting. "
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "gzMhbJmEf9vC",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "from __future__ import division\n",
        "from google.colab import drive\n",
        "drive.mount('/content/gdrive')"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "15DCLJ6CEihX",
        "colab_type": "code",
        "outputId": "60b71728-bcb5-46e7-9c5b-4f79ed57e008",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 190
        }
      },
      "source": [
        "!pip install deepdish"
      ],
      "execution_count": 8,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Collecting deepdish\n",
            "  Downloading https://files.pythonhosted.org/packages/6e/39/2a47c852651982bc5eb39212ac110284dd20126bdc7b49bde401a0139f5d/deepdish-0.3.6-py2.py3-none-any.whl\n",
            "Requirement already satisfied: scipy in /usr/local/lib/python3.6/dist-packages (from deepdish) (1.3.1)\n",
            "Requirement already satisfied: tables in /usr/local/lib/python3.6/dist-packages (from deepdish) (3.4.4)\n",
            "Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from deepdish) (1.16.5)\n",
            "Requirement already satisfied: numexpr>=2.5.2 in /usr/local/lib/python3.6/dist-packages (from tables->deepdish) (2.7.0)\n",
            "Requirement already satisfied: six>=1.9.0 in /usr/local/lib/python3.6/dist-packages (from tables->deepdish) (1.12.0)\n",
            "Installing collected packages: deepdish\n",
            "Successfully installed deepdish-0.3.6\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "8z_U7Dgxkm3K",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 581
        },
        "outputId": "26ed6eaa-c057-4d59-c986-e9d59d025400"
      },
      "source": [
        "!pip install wfdb"
      ],
      "execution_count": 10,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Collecting wfdb\n",
            "\u001b[?25l  Downloading https://files.pythonhosted.org/packages/b2/96/c2200539fdf4f087e14d30ed62a66544b6f441196bcb8ecc7a29ec6503b9/wfdb-2.2.1.tar.gz (94kB)\n",
            "\u001b[K     |████████████████████████████████| 102kB 8.4MB/s \n",
            "\u001b[?25hCollecting nose>=1.3.7 (from wfdb)\n",
            "\u001b[?25l  Downloading https://files.pythonhosted.org/packages/15/d8/dd071918c040f50fa1cf80da16423af51ff8ce4a0f2399b7bf8de45ac3d9/nose-1.3.7-py3-none-any.whl (154kB)\n",
            "\u001b[K     |████████████████████████████████| 163kB 21.9MB/s \n",
            "\u001b[?25hRequirement already satisfied: numpy>=1.11.0 in /usr/local/lib/python3.6/dist-packages (from wfdb) (1.15.4)\n",
            "Requirement already satisfied: matplotlib>=1.5.1 in /usr/local/lib/python3.6/dist-packages (from wfdb) (3.0.3)\n",
            "Requirement already satisfied: requests>=2.10.0 in /usr/local/lib/python3.6/dist-packages (from wfdb) (2.21.0)\n",
            "Requirement already satisfied: pandas>=0.19.1 in /usr/local/lib/python3.6/dist-packages (from wfdb) (0.24.2)\n",
            "Requirement already satisfied: scipy>=0.19.0 in /usr/local/lib/python3.6/dist-packages (from wfdb) (1.3.1)\n",
            "Requirement already satisfied: sklearn>=0.0 in /usr/local/lib/python3.6/dist-packages (from wfdb) (0.0)\n",
            "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/dist-packages (from matplotlib>=1.5.1->wfdb) (0.10.0)\n",
            "Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib>=1.5.1->wfdb) (2.5.3)\n",
            "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib>=1.5.1->wfdb) (2.4.2)\n",
            "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib>=1.5.1->wfdb) (1.1.0)\n",
            "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests>=2.10.0->wfdb) (2019.9.11)\n",
            "Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/dist-packages (from requests>=2.10.0->wfdb) (3.0.4)\n",
            "Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests>=2.10.0->wfdb) (2.8)\n",
            "Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests>=2.10.0->wfdb) (1.24.3)\n",
            "Requirement already satisfied: pytz>=2011k in /usr/local/lib/python3.6/dist-packages (from pandas>=0.19.1->wfdb) (2018.9)\n",
            "Requirement already satisfied: scikit-learn in /usr/local/lib/python3.6/dist-packages (from sklearn>=0.0->wfdb) (0.21.3)\n",
            "Requirement already satisfied: six in /usr/local/lib/python3.6/dist-packages (from cycler>=0.10->matplotlib>=1.5.1->wfdb) (1.12.0)\n",
            "Requirement already satisfied: setuptools in /usr/local/lib/python3.6/dist-packages (from kiwisolver>=1.0.1->matplotlib>=1.5.1->wfdb) (41.2.0)\n",
            "Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn->sklearn>=0.0->wfdb) (0.14.0)\n",
            "Building wheels for collected packages: wfdb\n",
            "  Building wheel for wfdb (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
            "  Created wheel for wfdb: filename=wfdb-2.2.1-cp36-none-any.whl size=100368 sha256=b342c7d5b55451b64dcf04ce234b7d257be809893901eae3343d3bc17db4e277\n",
            "  Stored in directory: /root/.cache/pip/wheels/bb/a9/00/0078d26b0c15b31be0001af8eb659496709c361c69641303f1\n",
            "Successfully built wfdb\n",
            "Installing collected packages: nose, wfdb\n",
            "Successfully installed nose-1.3.7 wfdb-2.2.1\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "_KHsyFPyLNJR",
        "colab_type": "code",
        "outputId": "c7f83be4-2e95-42a6-90bb-e50d04b094c7",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 310
        }
      },
      "source": [
        "!pip install numpy==1.15.4"
      ],
      "execution_count": 9,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Collecting numpy==1.15.4\n",
            "\u001b[?25l  Downloading https://files.pythonhosted.org/packages/ff/7f/9d804d2348471c67a7d8b5f84f9bc59fd1cefa148986f2b74552f8573555/numpy-1.15.4-cp36-cp36m-manylinux1_x86_64.whl (13.9MB)\n",
            "\u001b[K     |████████████████████████████████| 13.9MB 6.5MB/s \n",
            "\u001b[31mERROR: tensorflow 1.15.0rc3 has requirement numpy<2.0,>=1.16.0, but you'll have numpy 1.15.4 which is incompatible.\u001b[0m\n",
            "\u001b[31mERROR: datascience 0.10.6 has requirement folium==0.2.1, but you'll have folium 0.8.3 which is incompatible.\u001b[0m\n",
            "\u001b[31mERROR: albumentations 0.1.12 has requirement imgaug<0.2.7,>=0.2.5, but you'll have imgaug 0.2.9 which is incompatible.\u001b[0m\n",
            "\u001b[?25hInstalling collected packages: numpy\n",
            "  Found existing installation: numpy 1.16.5\n",
            "    Uninstalling numpy-1.16.5:\n",
            "      Successfully uninstalled numpy-1.16.5\n",
            "Successfully installed numpy-1.15.4\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "display_data",
          "data": {
            "application/vnd.colab-display-data+json": {
              "pip_warning": {
                "packages": [
                  "numpy"
                ]
              }
            }
          },
          "metadata": {
            "tags": []
          }
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "uD-Vt5ZFHVCP",
        "colab_type": "text"
      },
      "source": [
        "Here, restart the runtime. "
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "X1OAY5xYIdxN",
        "colab_type": "code",
        "outputId": "76335e21-67bf-49a9-82ac-59fdc4c9b93f",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "cd gdrive/'My Drive'"
      ],
      "execution_count": 4,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "/content/gdrive/My Drive\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "YUlbswjMIB1W",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "!git clone https://github.com/physhik/ecg-mit-bih.git"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "RLj0fQiVOTbd",
        "colab_type": "code",
        "outputId": "2312b803-0448-4fc3-d44e-e057fd214d3c",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "cd ecg-mit-bih/src"
      ],
      "execution_count": 5,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "/content/gdrive/My Drive/ecg-mit-bih/src\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "4mXnKUSKIm1h",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# You need to download data and excute data processing. However, it takes much time and it run without GPU. I recommend you to run the codes at your local computer instead. \n",
        "\n",
        "# !python data.py --downloading True"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "0gdiDCuAOU9O",
        "colab_type": "code",
        "outputId": "cc895b43-b9e4-4660-f33a-b155811d6bff",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "source": [
        "# Change the configurations upon your taste. The detail options of the configurations can be found at config.py file.  \n",
        "\n",
        "!python train.py --epoch 11"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Using TensorFlow backend.\n",
            "feature: MLII\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:541: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:66: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:4479: The name tf.truncated_normal is deprecated. Please use tf.random.truncated_normal instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:148: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:4267: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3733: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.\n",
            "Instructions for updating:\n",
            "Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:4432: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/optimizers.py:793: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3576: The name tf.log is deprecated. Please use tf.math.log instead.\n",
            "\n",
            "Model: \"model_1\"\n",
            "__________________________________________________________________________________________________\n",
            "Layer (type)                    Output Shape         Param #     Connected to                     \n",
            "==================================================================================================\n",
            "input (InputLayer)              (None, 256, 1)       0                                            \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_1 (Conv1D)               (None, 256, 32)      544         input[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_1 (BatchNor (None, 256, 32)      128         conv1d_1[0][0]                   \n",
            "__________________________________________________________________________________________________\n",
            "activation_1 (Activation)       (None, 256, 32)      0           batch_normalization_1[0][0]      \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_2 (Conv1D)               (None, 256, 32)      16416       activation_1[0][0]               \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_2 (BatchNor (None, 256, 32)      128         conv1d_2[0][0]                   \n",
            "__________________________________________________________________________________________________\n",
            "activation_2 (Activation)       (None, 256, 32)      0           batch_normalization_2[0][0]      \n",
            "__________________________________________________________________________________________________\n",
            "dropout_1 (Dropout)             (None, 256, 32)      0           activation_2[0][0]               \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_1 (MaxPooling1D)  (None, 256, 32)      0           activation_1[0][0]               \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_3 (Conv1D)               (None, 256, 32)      16416       dropout_1[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "add_1 (Add)                     (None, 256, 32)      0           max_pooling1d_1[0][0]            \n",
            "                                                                 conv1d_3[0][0]                   \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_3 (BatchNor (None, 256, 32)      128         add_1[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "activation_3 (Activation)       (None, 256, 32)      0           batch_normalization_3[0][0]      \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_4 (Conv1D)               (None, 128, 32)      16416       activation_3[0][0]               \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_4 (BatchNor (None, 128, 32)      128         conv1d_4[0][0]                   \n",
            "__________________________________________________________________________________________________\n",
            "activation_4 (Activation)       (None, 128, 32)      0           batch_normalization_4[0][0]      \n",
            "__________________________________________________________________________________________________\n",
            "dropout_2 (Dropout)             (None, 128, 32)      0           activation_4[0][0]               \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_2 (MaxPooling1D)  (None, 128, 32)      0           add_1[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_5 (Conv1D)               (None, 128, 32)      16416       dropout_2[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "add_2 (Add)                     (None, 128, 32)      0           max_pooling1d_2[0][0]            \n",
            "                                                                 conv1d_5[0][0]                   \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_5 (BatchNor (None, 128, 32)      128         add_2[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "activation_5 (Activation)       (None, 128, 32)      0           batch_normalization_5[0][0]      \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_6 (Conv1D)               (None, 128, 32)      16416       activation_5[0][0]               \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_6 (BatchNor (None, 128, 32)      128         conv1d_6[0][0]                   \n",
            "__________________________________________________________________________________________________\n",
            "activation_6 (Activation)       (None, 128, 32)      0           batch_normalization_6[0][0]      \n",
            "__________________________________________________________________________________________________\n",
            "dropout_3 (Dropout)             (None, 128, 32)      0           activation_6[0][0]               \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_3 (MaxPooling1D)  (None, 128, 32)      0           add_2[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_7 (Conv1D)               (None, 128, 32)      16416       dropout_3[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "add_3 (Add)                     (None, 128, 32)      0           max_pooling1d_3[0][0]            \n",
            "                                                                 conv1d_7[0][0]                   \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_7 (BatchNor (None, 128, 32)      128         add_3[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "activation_7 (Activation)       (None, 128, 32)      0           batch_normalization_7[0][0]      \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_8 (Conv1D)               (None, 64, 32)       16416       activation_7[0][0]               \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_8 (BatchNor (None, 64, 32)       128         conv1d_8[0][0]                   \n",
            "__________________________________________________________________________________________________\n",
            "activation_8 (Activation)       (None, 64, 32)       0           batch_normalization_8[0][0]      \n",
            "__________________________________________________________________________________________________\n",
            "dropout_4 (Dropout)             (None, 64, 32)       0           activation_8[0][0]               \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_4 (MaxPooling1D)  (None, 64, 32)       0           add_3[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_9 (Conv1D)               (None, 64, 32)       16416       dropout_4[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "add_4 (Add)                     (None, 64, 32)       0           max_pooling1d_4[0][0]            \n",
            "                                                                 conv1d_9[0][0]                   \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_9 (BatchNor (None, 64, 32)       128         add_4[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "activation_9 (Activation)       (None, 64, 32)       0           batch_normalization_9[0][0]      \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_10 (Conv1D)              (None, 64, 32)       16416       activation_9[0][0]               \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_10 (BatchNo (None, 64, 32)       128         conv1d_10[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "activation_10 (Activation)      (None, 64, 32)       0           batch_normalization_10[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "dropout_5 (Dropout)             (None, 64, 32)       0           activation_10[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_5 (MaxPooling1D)  (None, 64, 32)       0           add_4[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_11 (Conv1D)              (None, 64, 32)       16416       dropout_5[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "add_5 (Add)                     (None, 64, 32)       0           max_pooling1d_5[0][0]            \n",
            "                                                                 conv1d_11[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_11 (BatchNo (None, 64, 32)       128         add_5[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "activation_11 (Activation)      (None, 64, 32)       0           batch_normalization_11[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_12 (Conv1D)              (None, 32, 64)       32832       activation_11[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_12 (BatchNo (None, 32, 64)       256         conv1d_12[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "activation_12 (Activation)      (None, 32, 64)       0           batch_normalization_12[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_6 (MaxPooling1D)  (None, 32, 32)       0           add_5[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "dropout_6 (Dropout)             (None, 32, 64)       0           activation_12[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "lambda_1 (Lambda)               (None, 32, 64)       0           max_pooling1d_6[0][0]            \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_13 (Conv1D)              (None, 32, 64)       65600       dropout_6[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "add_6 (Add)                     (None, 32, 64)       0           lambda_1[0][0]                   \n",
            "                                                                 conv1d_13[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_13 (BatchNo (None, 32, 64)       256         add_6[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "activation_13 (Activation)      (None, 32, 64)       0           batch_normalization_13[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_14 (Conv1D)              (None, 32, 64)       65600       activation_13[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_14 (BatchNo (None, 32, 64)       256         conv1d_14[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "activation_14 (Activation)      (None, 32, 64)       0           batch_normalization_14[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "dropout_7 (Dropout)             (None, 32, 64)       0           activation_14[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_7 (MaxPooling1D)  (None, 32, 64)       0           add_6[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_15 (Conv1D)              (None, 32, 64)       65600       dropout_7[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "add_7 (Add)                     (None, 32, 64)       0           max_pooling1d_7[0][0]            \n",
            "                                                                 conv1d_15[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_15 (BatchNo (None, 32, 64)       256         add_7[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "activation_15 (Activation)      (None, 32, 64)       0           batch_normalization_15[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_16 (Conv1D)              (None, 16, 64)       65600       activation_15[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_16 (BatchNo (None, 16, 64)       256         conv1d_16[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "activation_16 (Activation)      (None, 16, 64)       0           batch_normalization_16[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "dropout_8 (Dropout)             (None, 16, 64)       0           activation_16[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_8 (MaxPooling1D)  (None, 16, 64)       0           add_7[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_17 (Conv1D)              (None, 16, 64)       65600       dropout_8[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "add_8 (Add)                     (None, 16, 64)       0           max_pooling1d_8[0][0]            \n",
            "                                                                 conv1d_17[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_17 (BatchNo (None, 16, 64)       256         add_8[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "activation_17 (Activation)      (None, 16, 64)       0           batch_normalization_17[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_18 (Conv1D)              (None, 16, 64)       65600       activation_17[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_18 (BatchNo (None, 16, 64)       256         conv1d_18[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "activation_18 (Activation)      (None, 16, 64)       0           batch_normalization_18[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "dropout_9 (Dropout)             (None, 16, 64)       0           activation_18[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_9 (MaxPooling1D)  (None, 16, 64)       0           add_8[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_19 (Conv1D)              (None, 16, 64)       65600       dropout_9[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "add_9 (Add)                     (None, 16, 64)       0           max_pooling1d_9[0][0]            \n",
            "                                                                 conv1d_19[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_19 (BatchNo (None, 16, 64)       256         add_9[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "activation_19 (Activation)      (None, 16, 64)       0           batch_normalization_19[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_20 (Conv1D)              (None, 8, 128)       131200      activation_19[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_20 (BatchNo (None, 8, 128)       512         conv1d_20[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "activation_20 (Activation)      (None, 8, 128)       0           batch_normalization_20[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_10 (MaxPooling1D) (None, 8, 64)        0           add_9[0][0]                      \n",
            "__________________________________________________________________________________________________\n",
            "dropout_10 (Dropout)            (None, 8, 128)       0           activation_20[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "lambda_2 (Lambda)               (None, 8, 128)       0           max_pooling1d_10[0][0]           \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_21 (Conv1D)              (None, 8, 128)       262272      dropout_10[0][0]                 \n",
            "__________________________________________________________________________________________________\n",
            "add_10 (Add)                    (None, 8, 128)       0           lambda_2[0][0]                   \n",
            "                                                                 conv1d_21[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_21 (BatchNo (None, 8, 128)       512         add_10[0][0]                     \n",
            "__________________________________________________________________________________________________\n",
            "activation_21 (Activation)      (None, 8, 128)       0           batch_normalization_21[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_22 (Conv1D)              (None, 8, 128)       262272      activation_21[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_22 (BatchNo (None, 8, 128)       512         conv1d_22[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "activation_22 (Activation)      (None, 8, 128)       0           batch_normalization_22[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "dropout_11 (Dropout)            (None, 8, 128)       0           activation_22[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_11 (MaxPooling1D) (None, 8, 128)       0           add_10[0][0]                     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_23 (Conv1D)              (None, 8, 128)       262272      dropout_11[0][0]                 \n",
            "__________________________________________________________________________________________________\n",
            "add_11 (Add)                    (None, 8, 128)       0           max_pooling1d_11[0][0]           \n",
            "                                                                 conv1d_23[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_23 (BatchNo (None, 8, 128)       512         add_11[0][0]                     \n",
            "__________________________________________________________________________________________________\n",
            "activation_23 (Activation)      (None, 8, 128)       0           batch_normalization_23[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_24 (Conv1D)              (None, 4, 128)       262272      activation_23[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_24 (BatchNo (None, 4, 128)       512         conv1d_24[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "activation_24 (Activation)      (None, 4, 128)       0           batch_normalization_24[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "dropout_12 (Dropout)            (None, 4, 128)       0           activation_24[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_12 (MaxPooling1D) (None, 4, 128)       0           add_11[0][0]                     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_25 (Conv1D)              (None, 4, 128)       262272      dropout_12[0][0]                 \n",
            "__________________________________________________________________________________________________\n",
            "add_12 (Add)                    (None, 4, 128)       0           max_pooling1d_12[0][0]           \n",
            "                                                                 conv1d_25[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_25 (BatchNo (None, 4, 128)       512         add_12[0][0]                     \n",
            "__________________________________________________________________________________________________\n",
            "activation_25 (Activation)      (None, 4, 128)       0           batch_normalization_25[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_26 (Conv1D)              (None, 4, 128)       262272      activation_25[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_26 (BatchNo (None, 4, 128)       512         conv1d_26[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "activation_26 (Activation)      (None, 4, 128)       0           batch_normalization_26[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "dropout_13 (Dropout)            (None, 4, 128)       0           activation_26[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_13 (MaxPooling1D) (None, 4, 128)       0           add_12[0][0]                     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_27 (Conv1D)              (None, 4, 128)       262272      dropout_13[0][0]                 \n",
            "__________________________________________________________________________________________________\n",
            "add_13 (Add)                    (None, 4, 128)       0           max_pooling1d_13[0][0]           \n",
            "                                                                 conv1d_27[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_27 (BatchNo (None, 4, 128)       512         add_13[0][0]                     \n",
            "__________________________________________________________________________________________________\n",
            "activation_27 (Activation)      (None, 4, 128)       0           batch_normalization_27[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_28 (Conv1D)              (None, 2, 256)       524544      activation_27[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_28 (BatchNo (None, 2, 256)       1024        conv1d_28[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "activation_28 (Activation)      (None, 2, 256)       0           batch_normalization_28[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_14 (MaxPooling1D) (None, 2, 128)       0           add_13[0][0]                     \n",
            "__________________________________________________________________________________________________\n",
            "dropout_14 (Dropout)            (None, 2, 256)       0           activation_28[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "lambda_3 (Lambda)               (None, 2, 256)       0           max_pooling1d_14[0][0]           \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_29 (Conv1D)              (None, 2, 256)       1048832     dropout_14[0][0]                 \n",
            "__________________________________________________________________________________________________\n",
            "add_14 (Add)                    (None, 2, 256)       0           lambda_3[0][0]                   \n",
            "                                                                 conv1d_29[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_29 (BatchNo (None, 2, 256)       1024        add_14[0][0]                     \n",
            "__________________________________________________________________________________________________\n",
            "activation_29 (Activation)      (None, 2, 256)       0           batch_normalization_29[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_30 (Conv1D)              (None, 2, 256)       1048832     activation_29[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_30 (BatchNo (None, 2, 256)       1024        conv1d_30[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "activation_30 (Activation)      (None, 2, 256)       0           batch_normalization_30[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "dropout_15 (Dropout)            (None, 2, 256)       0           activation_30[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_15 (MaxPooling1D) (None, 2, 256)       0           add_14[0][0]                     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_31 (Conv1D)              (None, 2, 256)       1048832     dropout_15[0][0]                 \n",
            "__________________________________________________________________________________________________\n",
            "add_15 (Add)                    (None, 2, 256)       0           max_pooling1d_15[0][0]           \n",
            "                                                                 conv1d_31[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_31 (BatchNo (None, 2, 256)       1024        add_15[0][0]                     \n",
            "__________________________________________________________________________________________________\n",
            "activation_31 (Activation)      (None, 2, 256)       0           batch_normalization_31[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_32 (Conv1D)              (None, 1, 256)       1048832     activation_31[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_32 (BatchNo (None, 1, 256)       1024        conv1d_32[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "activation_32 (Activation)      (None, 1, 256)       0           batch_normalization_32[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "dropout_16 (Dropout)            (None, 1, 256)       0           activation_32[0][0]              \n",
            "__________________________________________________________________________________________________\n",
            "max_pooling1d_16 (MaxPooling1D) (None, 1, 256)       0           add_15[0][0]                     \n",
            "__________________________________________________________________________________________________\n",
            "conv1d_33 (Conv1D)              (None, 1, 256)       1048832     dropout_16[0][0]                 \n",
            "__________________________________________________________________________________________________\n",
            "add_16 (Add)                    (None, 1, 256)       0           max_pooling1d_16[0][0]           \n",
            "                                                                 conv1d_33[0][0]                  \n",
            "__________________________________________________________________________________________________\n",
            "batch_normalization_33 (BatchNo (None, 1, 256)       1024        add_16[0][0]                     \n",
            "__________________________________________________________________________________________________\n",
            "activation_33 (Activation)      (None, 1, 256)       0           batch_normalization_33[0][0]     \n",
            "__________________________________________________________________________________________________\n",
            "time_distributed_1 (TimeDistrib (None, 1, 6)         1542        activation_33[0][0]              \n",
            "==================================================================================================\n",
            "Total params: 8,407,782\n",
            "Trainable params: 8,400,934\n",
            "Non-trainable params: 6,848\n",
            "__________________________________________________________________________________________________\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/math_grad.py:1424: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.\n",
            "Instructions for updating:\n",
            "Use tf.where in 2.0, which has the same broadcast rule as np.where\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:1033: The name tf.assign_add is deprecated. Please use tf.compat.v1.assign_add instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:1020: The name tf.assign is deprecated. Please use tf.compat.v1.assign instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3005: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.\n",
            "\n",
            "Train on 22834 samples, validate on 4548 samples\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:190: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:197: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.\n",
            "\n",
            "2019-10-17 08:07:09.581417: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2300000000 Hz\n",
            "2019-10-17 08:07:09.581714: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x2f38840 initialized for platform Host (this does not guarantee that XLA will be used). Devices:\n",
            "2019-10-17 08:07:09.581773: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version\n",
            "2019-10-17 08:07:09.592070: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1\n",
            "2019-10-17 08:07:09.723866: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-10-17 08:07:09.724743: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x2f38f40 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:\n",
            "2019-10-17 08:07:09.724773: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Tesla K80, Compute Capability 3.7\n",
            "2019-10-17 08:07:09.726216: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-10-17 08:07:09.726931: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: \n",
            "name: Tesla K80 major: 3 minor: 7 memoryClockRate(GHz): 0.8235\n",
            "pciBusID: 0000:00:04.0\n",
            "2019-10-17 08:07:09.739010: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0\n",
            "2019-10-17 08:07:09.944393: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0\n",
            "2019-10-17 08:07:10.041157: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10.0\n",
            "2019-10-17 08:07:10.074050: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10.0\n",
            "2019-10-17 08:07:10.309924: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10.0\n",
            "2019-10-17 08:07:10.446646: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10.0\n",
            "2019-10-17 08:07:10.949093: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7\n",
            "2019-10-17 08:07:10.949438: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-10-17 08:07:10.950387: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-10-17 08:07:10.951180: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0\n",
            "2019-10-17 08:07:10.955849: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0\n",
            "2019-10-17 08:07:10.957824: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
            "2019-10-17 08:07:10.957867: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0 \n",
            "2019-10-17 08:07:10.957888: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N \n",
            "2019-10-17 08:07:10.959188: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-10-17 08:07:10.960117: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-10-17 08:07:10.960895: W tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc:39] Overriding allow_growth setting because the TF_FORCE_GPU_ALLOW_GROWTH environment variable is set. Original config value was 0.\n",
            "2019-10-17 08:07:10.960963: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10805 MB memory) -> physical GPU (device: 0, name: Tesla K80, pci bus id: 0000:00:04.0, compute capability: 3.7)\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:207: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:216: The name tf.is_variable_initialized is deprecated. Please use tf.compat.v1.is_variable_initialized instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:223: The name tf.variables_initializer is deprecated. Please use tf.compat.v1.variables_initializer instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/callbacks.py:1122: The name tf.summary.merge_all is deprecated. Please use tf.compat.v1.summary.merge_all instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/callbacks.py:1125: The name tf.summary.FileWriter is deprecated. Please use tf.compat.v1.summary.FileWriter instead.\n",
            "\n",
            "Epoch 1/11\n",
            "2019-10-17 08:07:28.166447: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0\n",
            "2019-10-17 08:07:29.221291: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7\n",
            "22834/22834 [==============================] - 39s 2ms/step - loss: 0.6149 - acc: 0.8026 - val_loss: 13.3401 - val_acc: 0.1715\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/callbacks.py:1265: The name tf.Summary is deprecated. Please use tf.compat.v1.Summary instead.\n",
            "\n",
            "Epoch 2/11\n",
            "22834/22834 [==============================] - 23s 991us/step - loss: 0.2098 - acc: 0.9355 - val_loss: 11.9307 - val_acc: 0.2579\n",
            "Epoch 3/11\n",
            "22834/22834 [==============================] - 22s 965us/step - loss: 0.1219 - acc: 0.9617 - val_loss: 0.6661 - val_acc: 0.8615\n",
            "Epoch 4/11\n",
            "22834/22834 [==============================] - 22s 966us/step - loss: 0.1004 - acc: 0.9678 - val_loss: 0.7418 - val_acc: 0.7962\n",
            "Epoch 5/11\n",
            "22834/22834 [==============================] - 22s 966us/step - loss: 0.1005 - acc: 0.9668 - val_loss: 4.5287 - val_acc: 0.3727\n",
            "Epoch 6/11\n",
            "22834/22834 [==============================] - 22s 964us/step - loss: 0.0886 - acc: 0.9714 - val_loss: 3.4091 - val_acc: 0.5792\n",
            "\n",
            "Epoch 00006: ReduceLROnPlateau reducing learning rate to 0.05000000074505806.\n",
            "Epoch 7/11\n",
            "22834/22834 [==============================] - 22s 968us/step - loss: 0.0659 - acc: 0.9778 - val_loss: 0.9296 - val_acc: 0.7293\n",
            "Epoch 8/11\n",
            "22834/22834 [==============================] - 22s 972us/step - loss: 0.0557 - acc: 0.9813 - val_loss: 0.5469 - val_acc: 0.8467\n",
            "Epoch 9/11\n",
            "22834/22834 [==============================] - 22s 971us/step - loss: 0.0564 - acc: 0.9809 - val_loss: 1.7138 - val_acc: 0.6209\n",
            "Epoch 10/11\n",
            "22834/22834 [==============================] - 22s 969us/step - loss: 0.0514 - acc: 0.9829 - val_loss: 0.5640 - val_acc: 0.8802\n",
            "\n",
            "Epoch 00010: saving model to models/MLII-latest.hdf5\n",
            "Epoch 11/11\n",
            "22834/22834 [==============================] - 22s 977us/step - loss: 0.0518 - acc: 0.9825 - val_loss: 0.5297 - val_acc: 0.8577\n",
            "              precision    recall  f1-score   support\n",
            "\n",
            "           0       0.95      0.82      0.88      1661\n",
            "           1       0.81      0.93      0.87       780\n",
            "           2       1.00      0.97      0.99      1538\n",
            "           3       0.10      0.12      0.11       136\n",
            "           4       0.00      0.00      0.00        26\n",
            "           5       0.99      0.98      0.99       407\n",
            "\n",
            "    accuracy                           0.88      4548\n",
            "   macro avg       0.64      0.64      0.64      4548\n",
            "weighted avg       0.92      0.88      0.90      4548\n",
            "\n",
            "Confusion matrix, without normalization\n",
            "[[1366   14    0  145  136    0]\n",
            " [  40  726    0    3    7    4]\n",
            " [   1   42 1495    0    0    0]\n",
            " [  14   96    0   16   10    0]\n",
            " [  10   15    0    0    0    1]\n",
            " [   3    4    0    0    0  400]]\n",
            "F1 score: [0.88271405 0.86583184 0.98582262 0.10666667 0.         0.98522167]\n",
            "AUC for N: 0.9995200238778037\n",
            "AUC for V: 0.9999571472298745\n",
            "AUC for /: 1.0\n",
            "AUC for A: 1.0\n",
            "AUC for ~: 1.0\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "rahf13tfUXLw",
        "colab_type": "text"
      },
      "source": [
        ""
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "1vqiaWwoPNKY",
        "colab_type": "code",
        "outputId": "cb242828-fc5d-4a20-f801-dfb6e4b796d0",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "source": [
        "!python predict.py"
      ],
      "execution_count": 7,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Using TensorFlow backend.\n",
            "The record of training2017/A01678.mat\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:541: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:4479: The name tf.truncated_normal is deprecated. Please use tf.random.truncated_normal instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:66: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:148: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3733: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.\n",
            "Instructions for updating:\n",
            "Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:4267: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:4432: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:190: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:197: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:203: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.\n",
            "\n",
            "2019-10-20 00:12:51.632413: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2300000000 Hz\n",
            "2019-10-20 00:12:51.632652: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0xa55d880 initialized for platform Host (this does not guarantee that XLA will be used). Devices:\n",
            "2019-10-20 00:12:51.632690: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version\n",
            "2019-10-20 00:12:51.639533: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1\n",
            "2019-10-20 00:12:51.798176: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-10-20 00:12:51.799034: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0xa55da40 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:\n",
            "2019-10-20 00:12:51.799067: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Tesla K80, Compute Capability 3.7\n",
            "2019-10-20 00:12:51.800479: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-10-20 00:12:51.801207: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: \n",
            "name: Tesla K80 major: 3 minor: 7 memoryClockRate(GHz): 0.8235\n",
            "pciBusID: 0000:00:04.0\n",
            "2019-10-20 00:12:51.952762: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0\n",
            "2019-10-20 00:12:52.156513: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0\n",
            "2019-10-20 00:12:52.243326: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10.0\n",
            "2019-10-20 00:12:52.273740: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10.0\n",
            "2019-10-20 00:12:52.499707: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10.0\n",
            "2019-10-20 00:12:52.630417: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10.0\n",
            "2019-10-20 00:12:53.044557: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7\n",
            "2019-10-20 00:12:53.044804: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-10-20 00:12:53.045624: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-10-20 00:12:53.046353: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0\n",
            "2019-10-20 00:12:53.052507: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0\n",
            "2019-10-20 00:12:53.054074: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
            "2019-10-20 00:12:53.054107: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0 \n",
            "2019-10-20 00:12:53.054121: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N \n",
            "2019-10-20 00:12:53.055212: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-10-20 00:12:53.056004: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-10-20 00:12:53.056790: W tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc:39] Overriding allow_growth setting because the TF_FORCE_GPU_ALLOW_GROWTH environment variable is set. Original config value was 0.\n",
            "2019-10-20 00:12:53.056849: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10805 MB memory) -> physical GPU (device: 0, name: Tesla K80, pci bus id: 0000:00:04.0, compute capability: 3.7)\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:207: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:216: The name tf.is_variable_initialized is deprecated. Please use tf.compat.v1.is_variable_initialized instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:223: The name tf.variables_initializer is deprecated. Please use tf.compat.v1.variables_initializer instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/optimizers.py:793: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3576: The name tf.log is deprecated. Please use tf.math.log instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/math_grad.py:1424: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.\n",
            "Instructions for updating:\n",
            "Use tf.where in 2.0, which has the same broadcast rule as np.where\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:1033: The name tf.assign_add is deprecated. Please use tf.compat.v1.assign_add instead.\n",
            "\n",
            "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:1020: The name tf.assign is deprecated. Please use tf.compat.v1.assign instead.\n",
            "\n",
            "2019-10-20 00:13:12.972494: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0\n",
            "2019-10-20 00:13:13.564740: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7\n",
            "The 5/42-record classified as Ventricular with 49.7% certainty\n",
            "The 6/42-record classified as Ventricular with 80.3% certainty\n",
            "The 21/42-record classified as Ventricular with 89.1% certainty\n",
            "The 36/42-record classified as Ventricular with 99.5% certainty\n",
            "The average of the predict is: [[9.0093011e-01 9.5520690e-02 1.5031480e-07 2.1731975e-03 1.3753945e-03\n",
            "  4.1187999e-07]]\n",
            "The most predicted label is N with 90.1% certainty\n",
            "The second predicted label is Ventricular with 9.6% certainty\n",
            "The original label of the record is N\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "-7qnOkBMm22g",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        ""
      ],
      "execution_count": 0,
      "outputs": []
    }
  ]
}